home *** CD-ROM | disk | FTP | other *** search
- Path: gail.ripco.com!mambuhl
- From: mambuhl@ripco.com (Martin Ambuhl)
- Newsgroups: comp.lang.c
- Subject: Re: Is this a compiler bu
- Date: 29 Feb 1996 22:23:57 GMT
- Organization: Ripco Communications, Inc.
- Message-ID: <4h591t$8nj@gail.ripco.com>
- NNTP-Posting-Host: golden.ripco.com
-
- "Edward J. Huff" <huffe@carbon.chem.nyu.edu>
- in <3135FEDB.65AA@carbon.chem.nyu.edu> asks:
-
- >Is this a bug? Or is it "support for traditional practice"?
-
- Neither, for my copy of gcc. It is erroneous.
-
- >==> static_bug.c <==
- >static const char foo[];
-
- >int
- >main(int argc, const char *argv[]) {
- > printf("foo = '%s'\n",foo);
- > return 0;
- >}
-
- >#ifdef DEFINE_IT
- >static const char foo[] = "bar";
- >#endif
-
- >==> static_bug2.c <==
- >const char foo[] = "baz";
- >carbon% gcc static*.c
-
- My copy of gcc reports (with my usual -Wall -ansi -pedantic):
- 1: array size missing in `foo'
- In function `main':
- 5: warning: implicit declaration of function `printf'
-
- >carbon% a.out
- >foo = 'baz'
-
- ...and certainly does not produce an executable.
-
- >carbon% gcc -DDEFINE_IT static*.c
-
- My copy of gcc reports (with my usual -Wall -ansi -pedantic):
- 1: array size missing in `foo'
- In function `main':
- 5: warning: implicit declaration of function `printf'
- At top level:
- 10: warning: initializer-string for array of chars is too long
-
- >carbon% a.out
- >foo = 'bar'
-
- ...and certainly does not produce an executable.
-
- --
- * Martin Ambuhl net: mambuhl@ripco.com
- * Chicago, IL (USA)
-